package org.msfj.admin.feign;

import org.msfj.admin.vo.DictVo;
import org.msfj.authority.client.configuration.ClientAutoConfiguration;
import org.msfj.common.model.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;


/**
 * 获取数据字典数据
 */
@FeignClient(value = "admin-service", configuration = {ClientAutoConfiguration.class})
public interface DicApi {
    /**
     * 根据code查询codeText
     *
     * @param code
     * @return
     */
    @GetMapping("/api/dic/getByCode")
    CommonResult<DictVo> getByCode(@RequestParam("code") String code);


    /**
     * 使用字典集合 key 返回项的 map{key=code,value=text}
     *
     * @param indexKey
     * @return
     */
    @GetMapping("/api/dic/getAllTextByIndexKey")
    CommonResult<Map<String, String>> getAllTextByIndexKey(@RequestParam("indexKey") String indexKey);
}
